package Dao;

import Model.Obj.User;
import Model.OrcUtils.JDBCUtils;
import Model.RedisUtils.Redis;
import redis.clients.jedis.Jedis;

import java.util.List;

public class RedisDao {

    public static List<User> setLoginRedis() {
        String sql = "select * from USERDATA";
        List<User> list = JDBCUtils.JDBCselect(sql,User.class);
        return list;
    }

    public static boolean contaisJedis(String name, String pwd) {
        Jedis jedis = Redis.getJedis();
        if (jedis.exists(name)){
            if (jedis.get(name).equals(pwd)){
                return true;
            } else {
                return false;
            }
        } else {
         return false;
        }
    }
}
